package com.kedacom.demo.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kedacom.demo.domain.User;
import com.kedacom.demo.repository.UserDao;

/**
 * UserService
 * @author luocanfeng
 * @date 2014-7-18
 */
@Service
@Transactional
public class UserService {

	@Resource
	private UserDao userDao;

	public void save(User user) {
		userDao.save(user);
	}

	public User get(Integer id) {
		return userDao.get(id);
	}

	public User getByEmail(String email) {
		return userDao.get(userDao.getIdByEmail(email));
	}

	public void update(User user) {
		userDao.update(user);
	}

	public List<User> listAll() {
		return userDao.listAll();
	}

}
